import { genID } from '@/utils/common'
import { cloneDeep } from 'lodash'

class Component {
  id: string
  category: string
  name: string
  tag: string

  constructor(
    id: string | undefined,
    category: string,
    name: string,
    tag: string,
  ) {
    this.category = category
    this.name = name
    this.tag = tag
    this.id = id || tag + '_' + genID(6)
  }

  toJson() {
    return JSON.parse(JSON.stringify(this))
  }
}
